#include <stdio.h>
#include <stdlib.h>
#define max(a,b) (((a) > (b)) ? (a) : (b))

int main(int argc, char const *argv[])
{
    int n, m = 0, *list, *dotList, result = 0, i, j, k;
    scanf("%d", &n);
    
    list = malloc(sizeof(int) * n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &list[i]);
        m = max(m, list[i]);
    }

    dotList = malloc(sizeof(int) * m + 1);
    for (i = 0; i < m + 1; i++)
    {
        dotList[i] = 0;
    }
    for (i = 0; i < n; i++)
    {
        dotList[list[i]] = 1;
    }
    for (i = 0, j = 0; i < n;)
    {
        while (!(dotList[j]))
            j++;
        list[i++] = j;
        j++;
    }
    
    for (i = 0; i < n; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            if (list[i] + list[j] <= m)
            {
                if (dotList[list[i] + list[j]] == 1)
                {
                    dotList[list[i] + list[j]] = 0;
                    // printf("%d %d %d\n", result, list[i], list[j]);
                    result++;
                }
            }
        }
    }
    
    printf("%d", result);
    return 0;
}
